package br.com.vertigo.sgci.util;

import java.io.IOException;
import java.util.Calendar;
import java.util.Date;

public class PropertiesLoaderImpl extends PropertySgci{  
	
		
	private static PropertiesLoaderImpl myInstance = null;
	private static Date dtCreation = new Date();
	
	private PropertiesLoaderImpl() throws IOException {		
		super();
	}
	
    public static PropertiesLoaderImpl getInstance(){
    	Calendar cal = Calendar.getInstance();    	
    	cal.setTime(new Date());
    	cal.add(Calendar.MINUTE, -30);
    	if(dtCreation.before(cal.getTime())){
    		myInstance = null;
    		dtCreation = new Date();
    	}
   		if (myInstance == null)	
			try {
				myInstance = new PropertiesLoaderImpl();
			} catch (IOException e) {
				e.printStackTrace();
		}
        return myInstance;
    }
   
}  